<template>
  <view>
    <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular="true">
      <swiper-item v-for="(item, i) in swiperList" :key="i">
        <navigator class="swiper-item" :url="'/subpkg/goods_detail/goods_detail?goods_id='+item.goods_id">
          <image :src="item.image_src"></image>
        </navigator>
      </swiper-item>
    </swiper>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        //轮播图数据
        swiperList: [{
          image_src: "/static/images/logo.png"
        }, {
          image_src: "/static/images/logo.png"
        }, ]
      };
    },
    onLoad() {
      this.getSwiperList()
    },
    methods: {
      getSwiperList() {
        // const res = await uni.$http.get('/具体接口路径')
        let res = {
          meta: {
            status: 200
          }
        }
        // console.log(res)
        // if (res.meta.status != 200) {
        //   return uni.showToast({
        //     title: '请求失败',
        //     duration: 1500,
        //     icon: 'none'
        //   })
        // } else {
        //   //成功
        //   // this.swiperList  = res
        // }
      }
    }
  }
</script>

<style lang="scss">
  swiper {
    height: 330rpx;

    .swiper-item,
    image {
      width: 100%;
      height: 100%;
    }
  }
</style>